<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
</head>

<body>
	<script>
		// 第一种
		// test1.js
		function say(param) {
			console.log(param);
			console.log(this);
		}
		export default say

		// 在另一个js文件中引入test1.js
		import say from "./test1.js"
		say("balbala")
		// 只能使用一次

		// 第二种
		// test.js
		let myName = "Tom";
		let myAge = 20;
		let myfn = function () {
			return "My name is" + myName + "! I'm '" + myAge + "years old."
		}
		let myClass = class myClass {
			static a = "yeah!";
		}
		export { myName, myAge, myfn, myClass }

		//在另一个js文件  引入test.js
		import { myName, myAge, myfn, myClass } from "./test.js";
		console.log(myfn());
		console.log(myAge);
		console.log(myName);
		console.log(myClass.a);
	</script>
</body>

</html>